package org.springblade.modules.repair.vo;

import cn.hutool.core.util.ObjectUtil;
import com.fasterxml.jackson.annotation.JsonFormat;
import com.fasterxml.jackson.databind.annotation.JsonSerialize;
import com.fasterxml.jackson.databind.ser.std.ToStringSerializer;
import lombok.Data;
import org.springblade.modules.repair.entity.MaintainPlanContentUser;
import org.springblade.modules.repair.enums.MaintainPlanContentEnum;

import java.math.BigDecimal;
import java.util.Date;
import java.util.List;

/**
 * @Date 10:15 2022/4/26
 * @Description {
 *   保养任务列表查询
 * }
 * @Author lsay
 **/
@Data
public class PlanCheckPageVO {

	/**
	 * 任务id
	 */
	@JsonSerialize(using = ToStringSerializer.class)
	private Long planId;

	@JsonSerialize(using = ToStringSerializer.class)
	private Long elevatorId;

	@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
	private Date planDate;

	private String elevatorAddress;

	@JsonSerialize(using = ToStringSerializer.class)
	private Long buildingId;

	private String buildingName;

	private List<String> templateNames;

	private Integer workMinute;

	@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
	private Date planBeginTime;

	@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
	private Date planEndTime;

	private Integer scoreStatus;

	private BigDecimal score;

	/**
	 * 任务类型
	 */
	private Integer typeStatus;
	private String typeStatusDesc;

	public void setTypeStatus(Integer typeStatus) {
		this.typeStatusDesc = MaintainPlanContentEnum.getName(typeStatus);
		this.typeStatus = typeStatus;
	}

	/**
	 * 任务状态 1-待开始 2-进行中 3-提交任务 4-签字完成
	 */
	private Integer status;

	private String statusDesc;

	/**
	 * 及时性 1-及时 2-逾期
	 */
	private String timeliness;

	/**
	 * 时长 1-过长 2-过短
	 */
	private String duration;

	/**
	 * 关联人员所属组名称
	 */
	private List<String> groupNames;
	/**
	 * 关联人员
	 */
	private List<MaintainPlanContentUser> planContentUserVos;

	/**
	 * 评分时间
	 */
	@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
	private Date scoreTime;

	/**
	 * 更新时间
	 */
	@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
	private Date updateTime;

	/**
	 * 0: 未延迟, 1: 延迟
	 */
	private Integer isDeferred;
	private String deferredDesc;

	public void setIsDeferred(Integer isDeferred) {
		this.isDeferred = isDeferred;
		if(ObjectUtil.isNotEmpty(isDeferred)){
			if(isDeferred.equals(1)){
				this.deferredDesc = "延期保养";
			}
		}
	}
}
